<template>
  <div>
    <ZWDrawer ref="zwRef" @close="close">
      <div class="content">
        <ZwTable ref="tableRef" class="table-box" :option="tableOption" :fetch-params="state.searchParams"
          :fetch-api="fetch()"> </ZwTable>
      </div>
    </ZWDrawer>
  </div>
</template>
<script lang="tsx" setup>
import { ref, reactive, watch } from 'vue'
import ZwTable from '@/components/zw/table/Table'
import ZWDrawer from '@/components/ZWDrawer.vue'
// import { flowData } from '@/api/customer/clubManage/commonSea'
import { flowData } from '@/api/customerCenter/customerSea'

import { deepCopy } from '@/utils/helper'
const emit = defineEmits(['close'])
const zwRef = ref(null)
const props = defineProps(['clubopen', 'rowid', 'title'])
const tableRef = ref<HTMLElement | null>(null)
const defaultParams = {}
const isopen = ref(false)
const state = reactive({
  searchParams: deepCopy(defaultParams)
})
let tableOption = [
  {
    type: 'index',
    label: '序号',
    width: 70,
    fixed: 'left'
  },
  {
    prop: 'type_name',
    label: '操作类型',
    width: 160,
    render({ row }) {
      return row?.type_name || '--'
    }
  },
  {
    prop: 'work_user',
    label: '原归属人',
    width: 160,
    render({ row }) {
      return row?.work_user || '--'
    }
  },
  {
    label: '操作人',
    prop: 'created_user',
    width: 160,
    render({ row }) {
      return row?.created_user || '--'
    }
  },
  {
    prop: 'new_work_user',
    label: '变更归属人',
    width: 160,
    render({ row }) {
      return row?.new_work_user || '--'
    }
  },
  {
    prop: 'created_at',
    label: '变更时间',
    width: 180,
    render({ row }) {
      return row?.created_at || '--'
    }
  }
]
const getids = () => {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(props.rowid)
    }, 1)
  })
}
const fetch = async () => {
  // 获取文件列表
  const id = await getids()
  const page_size = 99
  return [{ id, page_size }, flowData]
}
const close = () => {
  emit('close')
}
watch(
  () => props.clubopen,
  (val) => {
    if (val) {
      isopen.value = val
      zwRef.value.drawer = true
      zwRef.value.isShow = false
      zwRef.value.title = props.title
      zwRef.value.width = '800px'
    }
  }
)
</script>
<style scoped lang="scss">
.content {
  padding: 16px 0;
}
</style>
